home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr47 / wasm223.zip / CHECK1.ASM < prev    next >
Assembly Source File  |  1993-05-04  |  1KB  |  39 lines

  1. ;*******************************************;
  2. ; WASM Checksum Calculation, Standard Block ;
  3. ; By Eric Tauck                             ;
  4. ;                                           ;
  5. ; Defines:                                  ;
  6. ;                                           ;
  7. ;   SumBlk  return checksum of block        ;
  8. ;*******************************************;
  9.  
  10.         jmps    _check1_end
  11.  
  12. ;========================================
  13. ; Return the 8 or 16 bit checksum of a
  14. ; block.
  15. ;
  16. ; In: BX= address of bytes to check; CX=
  17. ;     bytes to check.
  18. ;
  19. ; Out: AL= 8 bit checksum; AX= 16 bit
  20. ;      checksum.
  21.  
  22. SumBlk  PROC    NEAR
  23.         sub     ax, ax          ;zero checksum
  24.         jcxz    _smblk2         ;jump if no bytes to check
  25.  
  26. ;--- loop for each byte
  27.  
  28. _smblk1 add     al, [bx]        ;add to checksum
  29.         adc     ah, 0           ;carry
  30.         inc     bx              ;next byte
  31.         loop    _smblk1         ;loop back
  32.  
  33. ;--- finished
  34.  
  35. _smblk2 ret
  36.         ENDP
  37.  
  38. _check1_end
  39.